package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {
    @Reference
    private UserLocationApi userLocationApi;

    /**
     * 保存地理位置
     * @param latitude 纬度
     * @param longitude 经度
     * @param address 位置名称
     * @return
     */
    public ResponseEntity saveLocation(Double latitude, Double longitude, String address) {
        userLocationApi.save(latitude, longitude, address, UserHolder.getUser().getId());
        return ResponseEntity.ok(null);
    }
}